<?php

try {
    if ((isset($_POST["username"], $_POST['password']))) {
        $username = $_POST["username"];
        $password = $_POST['password'];

        if (($username == "jayesh") && ($password == "test")) {
            session_start();
            $_SESSION['userid'] = '1';
            $_SESSION['username'] = $username;
            $_SESSION['userrole'] = "admin";
            header("location: home.php");
        } else {
            header("location: login.php");
        }
    }
} catch (Exception $e) {
    print "Exception : " . $e . getMessage();
    header("location: login.php");
}
?>